package com.auto.admin.constants;

import java.util.Arrays;

/**
 * @Description: 模块名称关系映射
 * @author liangshf
 * @date 2018-10-11
 */
public enum ModuleCategoryNameCode {

    /**
     * wap 微商城
     */
    WAP("wap", "微商城"),
    /**
     * 后台管理
     */
    BACKEND("backend", "后台管理"),
    ;

    private String code;
    private String desc;

    ModuleCategoryNameCode(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return  desc;
    }

    public static String getDesc(String name) {
        if(Arrays.stream(ModuleCategoryNameCode.values()).noneMatch(e -> e.getCode().equals(name))) return null;
        return  Arrays.stream(ModuleCategoryNameCode.values()).filter(e -> e.getCode().equals(name)).findFirst().orElse(null).getDesc();
    }
}
